#ifndef _PLAY_H_

// ······································//
// ··········Play section················//
// ······································//

// unsigned int update_set_num_playing()
// {
//     unsigned int ret = document_playing;
//     uint8_t i;
//     for (i = 1; i < folder_playing; i++)
//     {
//         ret = myDFPlayer.readFileCountsInFolder(i) + ret;
//     }
//     ret = ret + 1; // adjust
//     return ret;
// }

void normalplay()
{
    // if (myDFPlayer.available()){//```````将此赋值语句至于官方包中测试没有问题
    //     if (DFPlayerPlayFinished == myDFPlayer.readType() /* something*/)
    //     {
    //         current_play_min = 0;
    //         current_play_sec = 0;
    //     }}

    if ((folder_playing != folder_cash || document_playing != document_cash)&&!pause)
    {
        folder_cash = folder_playing;
        document_cash = document_playing;
        myDFPlayer.playFolder(folder_playing, document_playing);
        // if (FileIndexOut == myDFPlayer.readType())//将赋值语句放到官方函数解决
        // {

        //     myDFPlayer.playFolder(folder_playing, document_playing);
        // }
        current_play_min = 0;
        current_play_sec = 0;

        // Store the information
        switch (folder_playing)
        {
        case 2:
            folder2_lastplayed_document = document_playing;
            break;
        case 3:
            folder3_lastplayed_document = document_playing;
            break;
        }
        File file = SPIFFS.open("palyparamer/data.txt", "w");
        if (!file)
        {
            Serial.println("无法打开文件！");
        }

        file.println(String(folder_playing));
        file.println(String(folder2_lastplayed_document));
        file.println(String(folder3_lastplayed_document));

        file.close();
        Serial.println("数据写入成功");
        Serial.printf("写入数据：%d;%d;%d\n", folder_playing, folder2_lastplayed_document, folder3_lastplayed_document);
    }
}

#endif